package com.jzo2o.customer.controller.worker;

import com.jzo2o.common.constants.UserType;
import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.model.dto.response.BankAccountResDTO;
import com.jzo2o.customer.service.IAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description BankAccount
 * @Author apeng
 * @Date 2024-12-03
 */
@RestController
@RequestMapping("worker/bank-account")
@Api(tags = "服务端设置银行账户")
public class BankAccountController {

    @Autowired
    private IAccountService accountService;

    @ApiOperation("新增或更新银行账号信息")
    @PostMapping
    public void addOrUpdateBankAccount(@RequestBody BankAccountUpsertReqDTO dto){
        accountService.addOrUpdateBankAccount(dto, UserType.WORKER);
    }

    @GetMapping("/currentUserBankAccount")
    @ApiOperation("获取当前用户银行账号")
    public BankAccountResDTO getByIdAccount(Long id){
        return accountService.getByIdAccount(id);
    }


}
